{$CLEO .cs}
{$use cleo+}
0000:
              
model.Load(#pony)
038B: load_requested_models
           
const
   busted = 14@ 

end   
:Retry
repeat 
wait 0 
until model.Available(#pony)

    busted = false 
while $onmission >= 1   
wait 0  
   if $CAR_THEFTS_ACTIVE == false 
       then 
        if  00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere  -2202.3679 55.4139 35.3203  radius 100.0 100.0 100.0 
        then     
            if not  marker_enabled 2@ 
            then  
            2@ =  marker.CreateIconWithoutSphere(55 ,  -2202.3679, 55.4139, 35.3203)
                 //show_styled_text "~w~The Car is discovered" 4000 5 
            end
            if not is_Car_defined 0@
            then
                
                 
                 0@ = car.Create(#pony ,  -2202.3679, 55.4139, 35.3203)  
                 car.Angle(0@)= 1.4435
                 car.Health(0@ ) = 20000
                 09C4: set_car 0@ gas_tank_explosion_enabled 0
                 0423: set_car 0@ improved_handling_to 2.0 // (float)
                  0229: set_car 0@ primary_color_to 0 secondary_color_to 0
                 0E61: set_car_alarm 0@ mode 1
                 053F: set_car 0@ tires_vulnerability 0

                 wait 100   
            end 
        else
            
            if is_Car_defined  0@
            then
                car.RemoveReferences( 0@ )
            end 
            
             
            wait 100
        end 
            if is_Car_defined  0@
            then
                if coop
                then
                   if or
                    actor.InCar( player1, 0@)
                    actor.InCar( player2, 0@)
                   then
                      Jump @Start 
                   end            
                else
                  if  actor.InCar( player1, 0@)
                  then
                     Jump @Start 
                  end              
                end 
    
            end   
    end    
end 
//Cleanup 
:start
$MISSION_MUSIC_IS_ACTIVE = 2 
$CAR_THEFTS_ACTIVE = true 
        if   marker_enabled 2@ 
        then   
            marker.Disable( 2@ )
        end
0167: 1@ = create_marker_at -2146.6599 -102.5673 35.3203 color 4 flag 2
marker.SetIconSize(1@ , 3 )
show_styled_text "~w~Now deliver the car, don't let the cops see you in this car"  4000 5 
while $onmission >= 1   
wait 0 

    if  
     $WAVE >= 1 
    then
        if $WAVE < 3
        then
           $WAVE = 3 
        end
         busted = true 
        {
        if busted == false 
        then
            show_text_box "~r~YOU BLEW IT! ~w~Now the cops see you jacking the car, it's can't be delivered without notoriety, lose them first!"

            busted = true 
        end  }
    else
        busted = false 
    end 
    if is_Car_defined  0@
    then
        if  or 
        8205:   not actor $PLAYER_ACTOR near_car 0@ radius 120.0 120.0 120.0 flag 0
        car.Wrecked(0@ )
        then
        show_styled_text "~r~You lost the car to sell!" 4000 5
        018C: play_sound 1053  at 0.0 0.0 0.0

        car.RemoveReferences( 0@)
        if marker_enabled 1@
        then
           marker.Disable( 1@  )
        end     
            $DOING_DRUGS = false  
            $CAR_THEFTS_ACTIVE = false 
            $MISSION_MUSIC_IS_ACTIVE = 0 
            jump @Retry 
        end 
            if coop
            then
               if or
                actor.InCar( player1, 0@)
                actor.InCar( player2, 0@)
               then 
                    $DOING_DRUGS = true 
               else 
                    $DOING_DRUGS = false  
               end            
            else
               if  actor.InCar( player1, 0@)
              
               then
                   $DOING_DRUGS = true 
               else 
                    $DOING_DRUGS = false  
               end          
            end     
  
        if     
        01B0:   car 0@ sphere 1 in_sphere  -2146.6599 -102.5673 35.3203  radius 5.0 5.0 5.0 stopped 
        then
            018C: play_sound 1052  at 0.0 0.0 0.0
            show_styled_text "~y~Car delivered! ~w~$15000" 4000 5
            0109: player $PLAYER_CHAR money += 15000

            0407: store_coords_to 20@ 21@ 22@  from_car 0@  with_offset  2.0 0.0 -1.0

            if  actor.InCar(player1,0@)
            then
               // 0362: remove_actor player1 from_car_and_place_at 20@ 21@ 22@ 
                 0633: AS_actor player1 exit_car
            end
            0407: store_coords_to 20@ 21@ 22@  from_car 0@  with_offset  -2.0 0.0 -1.0

            if coop
            then
                if  actor.InCar(player2,0@)
                then
                    //0362: remove_actor player2 from_car_and_place_at 20@ 21@ 22@ 
                    0633: AS_actor player2 exit_car

                end            
            end 
            car.LockInCurrentPosition(0@   ) = true
            car.DoorStatus(0@, 2)
            car.SetImmunities(0@,1,1,1,1,1)
            car.RemoveReferences(0@)
            $CAR_THEFTS_DELIVERED += 1 
            break 
        end 
       
    end 
end 
if is_Car_defined  0@
then
    car.RemoveReferences( 0@ )
end 
if marker_enabled 1@
then
   marker.Disable( 1@  )
end          
if marker_enabled 2@
then
   marker.Disable( 2@  )
end          
$CAR_THEFTS_ACTIVE = false  
$DOING_DRUGS = false  
$MISSION_MUSIC_IS_ACTIVE = 0 
model.destroy(#pony)
terminate_this_custom_script